package svc

import (
	"github.com/zeromicro/go-zero/zrpc"
	"hema-fresh/api/internal/config"
	"hema-fresh/hemarpc/hemarpcclient"
)

type ServiceContext struct {
	Config config.Config
	//svc文件是依赖注入目录，所有 logic 层需要用到的依赖都要在这里进行显式注入
	HemaRpc hemarpcclient.Hemarpc //rpc对外出口，与hemarpc下的hemarpcclient文件进行连接
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:  c,
		HemaRpc: hemarpcclient.NewHemarpc(zrpc.MustNewClient(c.HemaRpc)),
	}
}
